<include file="nav:header"/>
<div class="container-fluid">
    <div class="row">
        <include file="Left:left-Common"/>
        <!-- right -->
        <div class="col-md-10 right">
            <div class="page-header" style="margin-right: 15px">
                <h3>{$page_title}</h3>
            </div>
            <form class="article" action="{:U('Article/savehand')}" method="post">
                <input name="id" type="hidden"    value="{$articles.id}">
                <div class="col-md-7">
                <div class="btn-group " role="group" aria-label="Large button group">
                    <a href="{:U('Article/index')}" type="button" class="btn btn-default">بارلىق ئۇچۇرلار</a>
                    <a href="{:U('Article/index')}" type="button" class="btn btn-default"> قايتىش</a>
                </div>
                <br><br>

                <!--表单-->
                    <div class="form-group">
                        <select class="form-control" name="pid">
                            <option value="">چوڭ سەھىپە</option>
                            <foreach name="classify" item="c">
                                <option <if condition="$articles.pid eq $c['id']">selected</if> value="{$c['id']}"><if condition="$c['pid'] neq 0">{$c.lavel|_repeat} ┘─</if>{$c['name']}</option>
                            </foreach>
                        </select>
                    </div>
                    <br>
                    <div class="form-group">
                        <input name="title" type="text" class="form-control" placeholder="تېما:" id="exampleInputEmail1" value="{$articles.title}">
                    </div>
                    <br>
                    <div class="form-group">
                        <input name="sort" type="number" class="form-control" placeholder="تەرتىب:" id="exampleInputPassword1" value="{$articles.sort}">
                    </div>
                    <br>
                    <div class="form-group">
                        <textarea name="summer" class="form-control" placeholder="ئۈزۈندە:" rows="3" >{$articles.summer}</textarea>
                    </div>
                    <div class="form-group">
                        <include file="Editor"/>
                        <if condition="$articles['content']">
                                <textarea type="text/plain" style="min-height: 350px;" id="content" name="content">{$articles.content}</textarea>
                            <elseif condition="$articles['content1']" />
                                <textarea type="text/plain" style="min-height: 350px;" id="content1" name="content1">{$articles.content1}</textarea>
                        </if>
                    </div>
                    <div class="form-group">
                        <input  name="author" type="text" class="form-control"   value="{$articles.author}">
                    </div>
                    <div class="form-group">
                        <input  name="standby1" type="text" class="form-control" value="{$articles['standby1']}"  placeholder="كېڭەيتىلمە رايۇن">
                    </div>
                    <div class="form-group">
                        <input  name="standby2" type="text" class="form-control" value="{$articles['standby2']}"   placeholder="كېڭەيتىلمە رايۇن">
                    </div>
                    <br>
                    <div class="btn-group checkbox">
                        <label class="btn btn-success btn-xs active" for="in1">
                            <input id="in1"  type="radio" name="status"  value="1" <if condition="$articles.status">checked</if> > ئوچۇق
                        </label>
                        <label class="btn btn-danger btn-xs" for="in2">
                           <input id="in2"  type="radio" name="status"  value="0" <if condition="$articles.status eq 0">checked</if> > تاقاق
                        </label>
                    </div>
                    <br><br>
                    <button style="width: 150px" type="submit" class="btn btn-primary">ساقلاش</button>
            </div>
                <div class="hidden-xs hidden-sm" style="height: 52px;"></div>
                <div class="col-md-4">
                    <div class="panel panel-default">
                        <div class="panel-heading" style="font-size: 15px">ئەسەر مۇقاۋا رەسىمى</div>
                        <div class="panel-body">
                            <button type="button" class="layui-btn pull-left" id="test1">
                                <i class="layui-icon"></i>رەسىم يوللاش
                            </button>
                            <input value="{$articles.thumb}" id="thumb" style="width: 70%"  name="thumb" class="form-control pull-right" />
                            <br>
                             <img  id="thumbface" src="/{$articles.thumb|_strpos}" />
                        </div>
                        <script>
                            layui.use('upload', function(){
                                var upload = layui.upload;
                                //执行实例
                                var uploadInst = upload.render({
                                    elem: '#test1' //绑定元素
                                    ,url: '{:U("Article/upload")}' //上传接口
                                    ,done: function(res){
                                        //上传完毕回调
                                        if(res.status == 1){
                                            layer.alert(res.message, {
                                                title:"سېستىما ئەسكەرتىشى",
                                                btn:"بىلدىم",
                                                icon: 6,
                                                skin: 'layer-ext-moon',
                                                time:500
                                            });
                                            $("#thumb").val(res.src) ;
                                            $("#thumbface").attr("src","/"+res.src) ;
                                        }else{
                                            layer.alert(res.message, {
                                                title:"سېستىما ئەسكەرتىشى",
                                                btn:"بىلدىم",
                                                icon: 5,
                                                skin: 'layer-ext-moon',
                                                time:1000
                                            });
                                        }
                                    }
                                    ,error: function(){
                                        //请求异常回调
                                    }
                                });
                            });
                        </script>
                    </div>
                    <div class="panel panel-default">
                        <div class="panel-heading" style="font-size: 15px">ئەسەرنىڭ باشقا تەڭشىكى</div>
                        <div class="panel-body layui-form">
                            <input style="width: 66%"   type="text" name="from_url" value="{$articles.from_url}" placeholder="مەنبە ئادرېسى:"   class="form-control pull-left">
                            <div class="pull-right col-md-4" style="margin-top: -2px">
                                <select name="from_source" lay-verify="required">
                                    <option value="">مەنبە تاللاڭ</option>
                                    <foreach name="list['source']" item="s">
                                        <option value="{$s.id}" <if condition="$articles.from_source eq $s['id']">selected</if>>{$s.name}</option>
                                    </foreach>
                                </select>
                                <script>
                                    //Demo
                                    layui.use('form', function(){
                                        var form = layui.form;
                                        //监听提交
                                        form.on('submit(formDemo)', function(data){
                                            layer.msg(JSON.stringify(data.field));
                                            return false;
                                        });
                                    });
                                </script>
                            </div>
                        </div>
                    </div>
                    <div class="panel panel-default">
                        <div class="panel-heading" style="font-size: 15px"> خەتكۈچ تاللاش </div>
                        <div class="panel-body">
                            <foreach name="tags" item="t">
                                <label class="checkbox-inline">
                                    <input type="checkbox" name="tag[]"  value="{$t['id']}" <if condition="in_array($t['id'],$tids)">checked</if> />  {$t['tname']}
                                </label>
                            </foreach>
                        </div>
                    </div>
                    <div class="panel panel-default">
                        <div class="panel-heading" style="font-size: 15px">  ئەسەر بېتى تەڭشەكلىرى </div>
                        <div class="panel-body" style="padding: 5px 0">
                            <div class="btn-group checkbox pull-left">
                                <label >
                                    تەگلىك رەڭگى <input value="{$articles.bgcolor}" style="direction: ltr;text-align: right"   type="text" name="bgcolor"   class="form-control">
                                </label>
                                <br><br>
                                <label  >
                                    خەت رەڭگى <input value="{$articles.color}" style="direction: ltr;text-align: right"    type="text" name="color"   class="form-control">
                                </label>
                            </div>
                            <div style="margin-top: 10px" class="btn-group checkbox pull-right">
                                <label >
                                     ۋاقىت بەلگىلەش<input value="{$articles.intime|date='Y-m-d H:i:s',###}" style="direction: ltr;text-align: center"  type="text" name="intime" id="DefineTime" class="form-control">
                                </label>
                                <br><br>
                            </div>
                        </div>
                    </div>
                    <!--<div class="panel panel-default">-->
                        <!--<div class="panel-heading" style="font-size: 15px">  ئەسەر تەۋسىيەلەش </div>-->
                        <!--<div class="panel-body" style="padding: 5px 0">-->
                            <!--<div style="margin-top: 10px;padding: 0 15px" class="btn-group checkbox ">-->
                                <!--<label class="checkbox-inline">-->
                                    <!--<input type="checkbox"  value="option1"> باش بەت-->
                                <!--</label>-->
                                <!--<label class="checkbox-inline">-->
                                    <!--<input type="checkbox"  value="option2"> خەۋەر-->
                                <!--</label>-->
                                <!--<label class="checkbox-inline">-->
                                    <!--<input type="checkbox"  value="option3"> مۇھىم-->
                                <!--</label>-->
                            <!--</div>-->
                        <!--</div>-->
                    <!--</div>-->
                </div>
            </form>
        </div>
    </div>
</div>
<div class="visible-md visible-lg" style="height:200px;"></div>
<script type="text/javascript">
    //时间选择器
    //添加文章的时候自动获取当前的时间
    jeDate({
        dateCell:"#DefineTime",
        format:"YYYY-MM-DD hh:mm:ss",
        isinitVal:true,
        isTime:true, //isClear:false,
        minDate:"2014-09-19 00:00:00",
        okfun:function(val){alert(val)}
    })
</script>
<include file="nav:footer"/>